***********************************************
** Figure 1 Ranking position of the status quo scenario: 1 (first)=most preferred to 9 (nineth)= least preferred. The status quo is the same scenario for all respondents and all respondents ranked the status quo.
***********************************************
* Sample: Nationally Representative samples 
** Israel : Jews + Arabs combined n=679
** Palestine : n=1194

**********************************************************************************
*************  ISRAEL *********************************************************
**********************************************************************************


frame create ISR_statusquo
frame change ISR_statusquo

*Load the data 
use "$rootfolder\Data\Israelis_ranking_data.dta", clear

* Kepp the ranking position of the status quo card
keep if number_continuous == 99


* histogram of position of the status quo Israeli representative sample
tab rank
tab rank if card_ranking_today_cardgam > 240 & repsample==1 | card_ranking_today_cardgam > 240 & consent_ipanel_project==1

* who rank the SQ as the most preferred ? Who rank it as the least preferred? 
gen SQ_rank1 = (rank==1)
tab SQ_rank1 if card_ranking_today_cardgam > 240 & repsample==1 | card_ranking_today_cardgam > 240 & consent_ipanel_project==1

gen SQ_rank9 = (rank==9)

preserve
keep if card_ranking_today_cardgam > 240 & repsample==1 | card_ranking_today_cardgam > 240 & consent_ipanel_project==1

*****  Section: Unconditional acceptability of deals *****************
* Who rank SQ first?
ttest demographics_gender , by(SQ_rank1)
ttest demographics_age , by(SQ_rank1)
bys SQ_rank1: sum demographics_age , det
ranksum demographics_age ,  by(SQ_rank1)

tab consent_ipanel_project SQ_rank1, chi2 cell
tab consent_district SQ_rank1, chi2 cell

* Who rank SQ last?
ttest demographics_gender , by(SQ_rank9)
ttest demographics_age , by(SQ_rank9)
bys SQ_rank9: sum demographics_age , det
ranksum demographics_age ,  by(SQ_rank9)

tab consent_ipanel_project SQ_rank9, chi2 cell
tab consent_district SQ_rank9, chi2 cell

restore

* Preapre data for Figure 1: Histogram of status-quo position by Israelis and Palestinians 
collapse (percent) player_id if card_ranking_today_cardgam > 240 & repsample==1 | card_ranking_today_cardgam > 240 & consent_ipanel_project==1, by(rank)
gen group = "Israel"
save "$rootfolder\Data\iPanelApr22_status_quo_rank_distribution.dta", replace


**********************************************************************************
*************  PALESTINE *********************************************************
**********************************************************************************


frame create PAL_statusquo
frame change PAL_statusquo

* Load the data
use "$rootfolder\Data\Palestinians_ranking_data.dta"

* Keep the ranking position of the status quo card
keep if card_number_psr  == 99

tab rank 

*****  Section: Unconditional acceptability of deals *****************
gen SQ_rank1 = (rank==1)
gen SQ_rank9 = (rank==9)

* Who rank SQ first?
tab rank gender, chi2
ttest gender , by(SQ_rank1)

ttest age , by(SQ_rank1)
bys SQ_rank1: sum age , det
ranksum age ,  by(SQ_rank1)

* Who rank SQ last?
ttest gender , by(SQ_rank9)
ttest age , by(SQ_rank9)
bys SQ_rank9: sum age , det
ranksum age ,  by(SQ_rank9)


* Prepare data for Figure 1: Histogram of status-quo position by Israelis and Palestinians 
collapse (percent) player_id, by(rank)
gen group = "Palestine"
save "$rootfolder\Data\PSR_status_quo_rank_distribution.dta", replace



**********************************************************************************
** FIGURE 1: Ranking position of the status quo scenario: 1 (first)=most preferred to 9 (nineth)= least preferred. The status quo is the same scenario for all respondents and all respondents ranked the status quo
**********************************************************************************
use "$rootfolder\Data\PSR_status_quo_rank_distribution.dta", clear
append using "$rootfolder\Data\iPanelApr22_status_quo_rank_distribution.dta"
reshape wide player_id, i(rank) j(group) string


* xlabel(1 "Most preferred" 9 "Least preferred")
graph bar (asis) player_idIsrael player_idPalestine, over(rank) horizontal ///
bar(1, color(ebblue)) bar(2, color(green)) ///
ytitle("Percent")   ///
legend(order(1 "Israel" 2 "Palestine") cols(1) region(color(none)) lstyle(none) ) ///
graphregion(fcolor(white)) 



